set(SCHEMAROUTER_TEST_PORTS 3000 3001 3002 3003)
foreach(VAR ${SCHEMAROUTER_TEST_PORTS})
  execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/prepare_shard.sh @TEST_HOST@ ${VAR} @TEST_USER@ @TEST_PASSWORD@ "db${VAR}")
endforeach()
execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/testschemarouter @TEST_HOST@ @TEST_PORT_DB@ @TEST_USER@ @TEST_PASSWORD@ RESULT_VARIABLE RVAL)
if(RVAL EQUAL 0)
  message("Test 1 passed.")
else()
  message(FATAL_ERROR "Test 1 failed with code ${RVAL}.")
endif()

execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/testschemarouter2 @TEST_HOST@ @TEST_PORT_DB@ @TEST_USER@ @TEST_PASSWORD@ RESULT_VARIABLE RVAL2)
if(RVAL2 EQUAL 0)
  message("Test 2 passed.")
else()
  message(FATAL_ERROR "Test 2 failed with code ${RVAL2}.")
endif()
